package com.zmytest.exception;

import com.zmytest.dto.ResponseDto;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created on 2019/1/2.
 *
 * @author zhangmingyu
 */
@ControllerAdvice
public class GlobalExceptionController {


    @ExceptionHandler(AccessException.class)
    @ResponseBody
    public ResponseDto accessException(AccessException accessException){
        return ResponseDto.fail(accessException.getMessage());
    }
}
